{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "ab5bddbe",
   "metadata": {},
   "source": [
    "# 1.用户输入\n",
    "> 1. input()\n",
    "> 2. input输出的数据类型是：string"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "48939ffd",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "name:zixuan\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "'zixuan'"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "input(\"name:\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "af071d90",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入用户名：zixuan\n",
      "请输入密码：20040913\n"
     ]
    }
   ],
   "source": [
    "# 用户注册\n",
    "username = input(\"请输入用户名：\")\n",
    "password = input(\"请输入密码：\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "f2766783",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "zixuan\n"
     ]
    }
   ],
   "source": [
    "print(username)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "83604dc5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "20040913\n"
     ]
    }
   ],
   "source": [
    "print(password)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "fc4d8d8c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "欢迎使用！！\n"
     ]
    }
   ],
   "source": [
    "# 用户登录\n",
    "if username == \"zixuan\" and password == \"20040913\":\n",
    "    print(\"欢迎使用！！\")\n",
    "else:\n",
    "    print(\"账号或密码不正确，请重新尝试！\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "101259dd",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入用户名:zixuan\n",
      "请输入密码:20040913\n",
      "欢迎尊贵的vvvvip用户登录!!!\n"
     ]
    }
   ],
   "source": [
    "# 用户注册\n",
    "username = input(\"请输入用户名:\")\n",
    "password = input(\"请输入密码:\")\n",
    "# 用户登录\n",
    "if username == \"zixuan\" and password == \"20040913\":\n",
    "    print(\"欢迎尊贵的vvvvip用户登录!!!\")\n",
    "else:\n",
    "    print(\"账号或密码不正确，请重新尝试!!!\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fca68b92",
   "metadata": {},
   "source": [
    "# 2.用户规范化格式化输出"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "537be533",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "输入你的姓名zixuan\n",
      "输入你的年龄:19\n",
      "输入你的职业:free\n",
      "输入你的薪资:10k\n",
      "-----INFO zixuan----\n",
      "姓名是：zixuan\n",
      "年龄是：19\n",
      "职业是：free\n",
      "薪资是：10k\n"
     ]
    }
   ],
   "source": [
    "name = input(\"输入你的姓名\")\n",
    "age = input(\"输入你的年龄:\")\n",
    "job = input(\"输入你的职业:\")\n",
    "salary = input(\"输入你的薪资:\")\n",
    "\n",
    "# info为展示的数据\n",
    "info = \"\"\"-----INFO %s----\n",
    "姓名是：%s\n",
    "年龄是：%s\n",
    "职业是：%s\n",
    "薪资是：%s\"\"\"%(name,name,age,job,salary)\n",
    "\n",
    "# 打印结果\n",
    "print(info)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3c363186",
   "metadata": {},
   "source": [
    "* 占位符\n",
    "> 1. 顺序\n",
    "> 2. %s 代表 字符串 %d 代表数字(整数) f% 代表小数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "03b470f1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "输入你的姓名zixuan\n",
      "输入你的年龄:19\n",
      "输入你的职业:free\n",
      "输入你的薪资:10k\n",
      "-----INFO zixuan----\n",
      "姓名是：zixuan\n",
      "年龄是：19\n",
      "职业是：free\n",
      "薪资是：10k\n"
     ]
    }
   ],
   "source": [
    "# 输入的内容\n",
    "name = input(\"输入你的姓名\")\n",
    "age = input(\"输入你的年龄:\")\n",
    "job = input(\"输入你的职业:\")\n",
    "salary = input(\"输入你的薪资:\")\n",
    "\n",
    "# info为展示的数据(前端)\n",
    "info = \"\"\"-----INFO {N}----\n",
    "姓名是：{N}\n",
    "年龄是：{A}\n",
    "职业是：{J}\n",
    "薪资是：{S}\"\"\".format(N=name,J=job,S=salary,A=age)\n",
    "\n",
    "# 打印结果\n",
    "print(info)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a25cf55e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
